package com.qianfeng.admin.controller;

import com.qianfeng.entity.po.LoginAdmin;
import com.qianfeng.http.Result;
import com.qianfeng.service.impl.AdminModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

    @Autowired
    private AdminModuleService adminModuleService;

    @RequestMapping("index")
    public String toIndex(Model model){
        return "index";
    }

    @RequestMapping("module-list")
    @ResponseBody
    public Result<?> getModuleList(LoginAdmin loginAdmin){
        return Result.success(adminModuleService.getModuleByAdminId(loginAdmin.getId()));
    }

}
